package cj.web.marriageSC.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.marriageSC.domain.SCGoodsBanner;

/**
 * 
 * @author 
 *
 */
@DAO
public interface SCGoodsBannerDAO{
	
	@SQL("SELECT * FROM SCGoodsBanner WHERE 1=1 "
	    	    				    		        	+ " AND goodsId=:t.goodsId,"
	        			    		        	+ " AND path=:t.path,"
	        				+" ORDER BY update_date DESC LIMIT :t.start,:t.end ")
    List<SCGoodsBanner> query(@SQLParam("t") SCGoodsBanner sCGoodsBanner);
    
    @SQL("select * from SCGoodsBanner where id=:1")
    SCGoodsBanner queryById(String id);
    
    @SQL("INSERT INTO SCGoodsBanner ("
    		        		+ "id,"
			        		+ "goodsId,"
			        		+ "path,"
							+") VALUES ("
							+ ":t.id,"
							+ ":t.goodsId,"
							+ ":t.path,"
					+")")
    void create(@SQLParam("t") SCGoodsBanner sCGoodsBanner);
	
	@SQL("UPDATE SCGoodsBanner SET "
		    		    						    			        + "goodsId=:t.goodsId,"
		        					    			        + "path=:t.path,"
		        						+ " WHERE id=:t.id")
    void update(@SQLParam("t") SCGoodsBanner sCGoodsBanner);
    
    @SQL("UPDATE SCGoodsBanner SET delete_flag=0 WHERE id=:1")
    void deleteById(String id);
}